package com.ckd.flyingtrip.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.fragment.app.Fragment;

import com.ckd.flyingtrip.R;
import com.ckd.flyingtrip.activity.BaseActivity;
import com.ckd.flyingtrip.adapter.Wallet_YouhuijuanAdapter;
import com.ckd.flyingtrip.utils.Tools;

//优惠券
public class MyWallet_Youhuijuan extends Fragment implements Wallet_YouhuijuanAdapter.Onc_battery {
    private Wallet_YouhuijuanAdapter wallet_youhuijuanAdapter;
    private ListView listview;
    private int pos;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v=inflater.inflate(R.layout.fragment_youhuijuan, container,false);
        wallet_youhuijuanAdapter = new Wallet_YouhuijuanAdapter((BaseActivity) getContext(),MyWallet_Youhuijuan.this);
        listview = v.findViewById(R.id.listview);
        listview.setAdapter(wallet_youhuijuanAdapter);
        wallet_youhuijuanAdapter.notifyDataSetChanged();
        v.findViewById(R.id.btn_res).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Tools.toast(""+pos);
            }
        });
        return v;
    }


    @Override
    public void click(View v,int posin) {
        pos = posin;
        wallet_youhuijuanAdapter.setChecked(posin);
        wallet_youhuijuanAdapter.notifyDataSetChanged();
    }
}
